package com.baturu.vin.hyundai.transformer;

import com.baturu.kit.kit.function.SafeFunction;
import com.baturu.vin.dto.superEPC.SEPCCarTypeDTO;
import com.baturu.vin.dto.superEPC.SEPCCarTypeDetailDTO;
import com.baturu.vin.dto.superEPC.SEPCExtendAttributeDTO;
import com.baturu.vin.hyundai.dto.HyundaiKiaVehicleDTO;
import com.google.common.collect.Lists;

/**
 * @Author: chenjiahao
 * @Time: 2019/5/7
 */
public class HyundaiKiaSEPCCarTypeTransformer {

    public static final SafeFunction<HyundaiKiaVehicleDTO, SEPCCarTypeDTO> VIN_INFO_TO_MULTI_HMODTYP_SEPC_CAR_TYPE = input ->
            SEPCCarTypeDTO
                    .builder()
                    .brandName(input.getChBrandName())
                    .carType(input.getModel())
                    .year(input.getDateByFormat())
                    .showCarType(input.getChBrandName()+" "+input.getCarSystem()+" "+input.getDateByFormat())
                    .btrId(input.getBtrId())
                    .carTypeDetailDTOList(Lists.newArrayList(
                            SEPCCarTypeDetailDTO.builder().desc("车型").subValue(input.getVehicle()).build(),
                            SEPCCarTypeDetailDTO.builder().desc("颜色").subValue(input.getColor()).build(),
                            SEPCCarTypeDetailDTO.builder().desc("选装码").subValue(input.getOption()).build()
                    ))
                    .extendAttrDTOs(Lists.newArrayList(
                            SEPCExtendAttributeDTO.builder().code("bpno").value(input.getBpno()).build(),
                            SEPCExtendAttributeDTO.builder().code("year").value(input.getCarTypeYear()).build(),
                            SEPCExtendAttributeDTO.builder().code("naif").value(input.getAreaNum()).build(),
                            SEPCExtendAttributeDTO.builder().code("micd").value(input.getMicd()).build(),
                            SEPCExtendAttributeDTO.builder().code("ocn").value(input.getOcn()).build(),
                            SEPCExtendAttributeDTO.builder().code("ver").value(input.getVer()).build()
                    ))
                    .build();
}
